﻿//using System.ServiceModel;

using ProtoBuf;
using ProtoBuf.Grpc;
using ProtoBuf.Grpc.Configuration;

namespace Shared;

//也可以使用System.ServiceModel空间下的特性
//[ServiceContract]
[Service]
public interface IOrderService
{
    //[OperationContract]
    [Operation]
    Task<CreateOrderResp> CreateOrderAsync(CreateOrderReq req, CallContext context = default);
}

//[DataContract]
[ProtoContract]
public class CreateOrderReq
{
    //[DataMember(Order = 1)]
    [ProtoMember(1)]
    public string Name { get; set; }

    //[DataMember(Order = 2)]
    [ProtoMember(2)]
    public double Price { get; set; }
}

//[DataContract]
[ProtoContract]
public class CreateOrderResp
{
    //[DataMember(Order = 1)]
    [ProtoMember(1)]
    public bool Success { get; set; }

    //[DataMember(Order = 2)]
    [ProtoMember(2)]
    public int? OrderId { get; set; }
}